<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Echarts3示例</title>
	
	<script src="plug-in/jquery/jquery-1.8.3.min.js"></script>
	<script src="plug-in/echarts3/echarts.min.js"></script>
</head>
<body>
    <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
    <div id="main" style="width: 600px;height:400px;float:left;"></div>
    
    <div id="main2" style="width: 600px;height:400px;float:right;"></div>
    
    <script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        myChart.clear();  
        myChart.showLoading({text: '正在努力的读取数据中...'}); 
      /*   $.ajax({
    		async : false,
    		cache : false,
    		type : 'get',
    		url : "echartsController.do?lineDemo",
    		error : function() {// 请求失败处理函数
    		},
    		success : function(data) {
    			var d = $.parseJSON(data);
    			console.log(d.msg);
    			if (d.success) {
    				myChart.setOption($.parseJSON(d.msg));  
                	myChart.hideLoading();   				 
    			}    			
    		}
    	});  */ 
        
        $.getJSON('echartsController.do?lineDemo', function (data) {  
            if (data.success) {  
            	myChart.setOption($.parseJSON(data.msg));  
            	myChart.hideLoading();  
            } else {  
                alert('提示', data.msg);  
            }  
        }); 
    	
    	
    	var myChart2 = echarts.init(document.getElementById('main2'));
    	myChart2.clear();  
    	myChart2.showLoading({text: '正在努力的读取数据中...'}); 
      /*   $.ajax({
    		async : false,
    		cache : false,
    		type : 'get',
    		url : "echartsController.do?lineDemo",
    		error : function() {// 请求失败处理函数
    		},
    		success : function(data) {
    			var d = $.parseJSON(data);
    			console.log(d.msg);
    			if (d.success) {
    				myChart.setOption($.parseJSON(d.msg));  
                	myChart.hideLoading();   				 
    			}    			
    		}
    	});  */ 
        
        $.getJSON('echartsController.do?barDemo', function (data) {  
            if (data.success) {  
            	myChart2.setOption($.parseJSON(data.msg));  
            	myChart2.hideLoading();  
            } else {  
                alert('提示', data.msg);  
            }  
        }); 


    </script>
</body>
</html>